{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"\n",
       "     width=\"165.0mm\" height=\"25.0mm\"\n",
       "     shape-rendering=\"crispEdges\">\n",
       "<rect x=\"0.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#0000FF\" stroke=\"none\" />\n",
       "<rect x=\"15.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#1A00E6\" stroke=\"none\" />\n",
       "<rect x=\"30.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#3300CC\" stroke=\"none\" />\n",
       "<rect x=\"45.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#4C00B2\" stroke=\"none\" />\n",
       "<rect x=\"60.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#660099\" stroke=\"none\" />\n",
       "<rect x=\"75.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#800080\" stroke=\"none\" />\n",
       "<rect x=\"90.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#990066\" stroke=\"none\" />\n",
       "<rect x=\"105.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#B2004C\" stroke=\"none\" />\n",
       "<rect x=\"120.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#CC0033\" stroke=\"none\" />\n",
       "<rect x=\"135.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#E6001A\" stroke=\"none\" />\n",
       "<rect x=\"150.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#FF0000\" stroke=\"none\" />\n",
       "</svg>"
      ],
      "text/plain": [
       "11-element ColorView{RGB}(::ImageCore.StackedView{Float64,2,Tuple{LinSpace{Float64},Array{Float64,1},LinSpace{Float64}}}) with element type ColorTypes.RGB{Float64}:\n",
       " RGB{Float64}(0.0,0.0,1.0)\n",
       " RGB{Float64}(0.1,0.0,0.9)\n",
       " RGB{Float64}(0.2,0.0,0.8)\n",
       " RGB{Float64}(0.3,0.0,0.7)\n",
       " RGB{Float64}(0.4,0.0,0.6)\n",
       " RGB{Float64}(0.5,0.0,0.5)\n",
       " RGB{Float64}(0.6,0.0,0.4)\n",
       " RGB{Float64}(0.7,0.0,0.3)\n",
       " RGB{Float64}(0.8,0.0,0.2)\n",
       " RGB{Float64}(0.9,0.0,0.1)\n",
       " RGB{Float64}(1.0,0.0,0.0)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "using Colors, Images\n",
    "r = linspace(0,1,11)\n",
    "g = zeros(11)\n",
    "b = linspace(1,0,11)\n",
    "img1d = colorview(RGB, r, g, b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO: Recompiling stale cache file /home/tim/.julia/lib/v0.5/ImageMagick.ji for module ImageMagick.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "278"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "open(joinpath(tempdir(), \"linspace.png\"), \"w\") do io\n",
    "    show(io, MIME(\"image/png\"), img1d')\n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "ename": "LoadError",
     "evalue": "LoadError: UndefVarError: img2 not defined\nwhile loading In[3], in expression starting on line 1",
     "output_type": "error",
     "traceback": [
      "LoadError: UndefVarError: img2 not defined\nwhile loading In[3], in expression starting on line 1",
      ""
     ]
    }
   ],
   "source": [
    "img2'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near In[4]:1\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near In[4]:1\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near In[4]:1\n",
      "in throw_colorerror at /home/tim/.julia/v0.5/ColorTypes/src/types.jl\n"
     ]
    },
    {
     "ename": "LoadError",
     "evalue": "LoadError: indexed assignment not defined for LinSpace{Float64}\nwhile loading In[4], in expression starting on line 1",
     "output_type": "error",
     "traceback": [
      "LoadError: indexed assignment not defined for LinSpace{Float64}\nwhile loading In[4], in expression starting on line 1",
      "",
      " in _unsafe_setindex_all! at /home/tim/.julia/v0.5/ImageCore/src/stackedviews.jl:82 [inlined]",
      " in setchannels! at /home/tim/.julia/v0.5/ImageCore/src/stackedviews.jl:93 [inlined]",
      " in setindex! at /home/tim/.julia/v0.5/ImageCore/src/colorchannels.jl:156 [inlined]",
      " in setindex!(::ImageCore.ColorView{ColorTypes.RGB{Float64},1,ImageCore.StackedView{Float64,2,Tuple{LinSpace{Float64},Array{Float64,1},LinSpace{Float64}}}}, ::ColorTypes.RGB{FixedPointNumbers.UFixed{UInt8,8}}, ::Int64) at /home/tim/.julia/v0.5/ImageCore/src/colorchannels.jl:160"
     ]
    }
   ],
   "source": [
    "img1d[1] = RGB(0,1,0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"\n",
       "     width=\"165.0mm\" height=\"25.0mm\"\n",
       "     shape-rendering=\"crispEdges\">\n",
       "<rect x=\"0.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#0000FF\" stroke=\"none\" />\n",
       "<rect x=\"15.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#1A00E6\" stroke=\"none\" />\n",
       "<rect x=\"30.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#3300CC\" stroke=\"none\" />\n",
       "<rect x=\"45.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#4C00B2\" stroke=\"none\" />\n",
       "<rect x=\"60.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#660099\" stroke=\"none\" />\n",
       "<rect x=\"75.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#800080\" stroke=\"none\" />\n",
       "<rect x=\"90.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#990066\" stroke=\"none\" />\n",
       "<rect x=\"105.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#B2004C\" stroke=\"none\" />\n",
       "<rect x=\"120.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#CC0033\" stroke=\"none\" />\n",
       "<rect x=\"135.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#E6001A\" stroke=\"none\" />\n",
       "<rect x=\"150.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#FF0000\" stroke=\"none\" />\n",
       "</svg>"
      ],
      "text/plain": [
       "11-element ColorView{RGB}(::Array{Float64,2}) with element type ColorTypes.RGB{Float64}:\n",
       " RGB{Float64}(0.0,0.0,1.0)\n",
       " RGB{Float64}(0.1,0.0,0.9)\n",
       " RGB{Float64}(0.2,0.0,0.8)\n",
       " RGB{Float64}(0.3,0.0,0.7)\n",
       " RGB{Float64}(0.4,0.0,0.6)\n",
       " RGB{Float64}(0.5,0.0,0.5)\n",
       " RGB{Float64}(0.6,0.0,0.4)\n",
       " RGB{Float64}(0.7,0.0,0.3)\n",
       " RGB{Float64}(0.8,0.0,0.2)\n",
       " RGB{Float64}(0.9,0.0,0.1)\n",
       " RGB{Float64}(1.0,0.0,0.0)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "img1dc = copy(img1d)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version\"1.0\" encoding=\"UTF-8\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"\n",
       "     width=\"25mm\" height=\"25mm\" viewBox=\"0 0 1 1\">\n",
       "     <rect width=\"1\" height=\"1\"\n",
       "           fill=\"#00FF00\" stroke=\"none\"/>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "RGB{U8}(0.0,1.0,0.0)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "img1dc[1] = RGB(0,1,0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n",
      "WARNING: FixedPointNumbers.UFixed8 is deprecated, use FixedPointNumbers.UFixed{UInt8, 8} instead.\n",
      "  likely near /home/tim/.julia/v0.5/IJulia/src/kernel.jl:31\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"\n",
       "     width=\"165.0mm\" height=\"25.0mm\"\n",
       "     shape-rendering=\"crispEdges\">\n",
       "<rect x=\"0.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#00FF00\" stroke=\"none\" />\n",
       "<rect x=\"15.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#1A00E6\" stroke=\"none\" />\n",
       "<rect x=\"30.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#3300CC\" stroke=\"none\" />\n",
       "<rect x=\"45.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#4C00B2\" stroke=\"none\" />\n",
       "<rect x=\"60.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#660099\" stroke=\"none\" />\n",
       "<rect x=\"75.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#800080\" stroke=\"none\" />\n",
       "<rect x=\"90.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#990066\" stroke=\"none\" />\n",
       "<rect x=\"105.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#B2004C\" stroke=\"none\" />\n",
       "<rect x=\"120.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#CC0033\" stroke=\"none\" />\n",
       "<rect x=\"135.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#E6001A\" stroke=\"none\" />\n",
       "<rect x=\"150.0mm\" y=\"0.0mm\"\n",
       "      width=\"14.0mm\" height=\"25.0mm\"\n",
       "      fill=\"#FF0000\" stroke=\"none\" />\n",
       "</svg>"
      ],
      "text/plain": [
       "11-element ColorView{RGB}(::Array{Float64,2}) with element type ColorTypes.RGB{Float64}:\n",
       " RGB{Float64}(0.0,1.0,0.0)\n",
       " RGB{Float64}(0.1,0.0,0.9)\n",
       " RGB{Float64}(0.2,0.0,0.8)\n",
       " RGB{Float64}(0.3,0.0,0.7)\n",
       " RGB{Float64}(0.4,0.0,0.6)\n",
       " RGB{Float64}(0.5,0.0,0.5)\n",
       " RGB{Float64}(0.6,0.0,0.4)\n",
       " RGB{Float64}(0.7,0.0,0.3)\n",
       " RGB{Float64}(0.8,0.0,0.2)\n",
       " RGB{Float64}(0.9,0.0,0.1)\n",
       " RGB{Float64}(1.0,0.0,0.0)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "img1dc"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"11-element ColorView{RGB}(::Array{Float64,2}) with element type ColorTypes.RGB{Float64}\""
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "summary(img1dc)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"11-element ColorView{RGB}(::ImageCore.StackedView{Float64,2,Tuple{LinSpace{Float64},Array{Float64,1},LinSpace{Float64}}}) with element type ColorTypes.RGB{Float64}\""
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "summary(img1d)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Julia 0.5.1-pre",
   "language": "julia",
   "name": "julia-0.5"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "0.5.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
